<template>
  <div>
    <el-input v-model="input"  placeholder="请输入内容"></el-input> <button @click="findAll">搜索</button>
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="createTime"
        label="生产日期"
        width="180">
      </el-table-column>
      <el-table-column
        prop="shopName"
        label="商品名称"
        width="180">
        <template slot-scope="scope">
          <span v-html="scope.row.shopName"></span>
        </template>
      </el-table-column>
      <el-table-column
        prop="shopDesc"
        label="商品描述">
        <template slot-scope="scope">
          <span v-html="scope.row.shopDesc"></span>
        </template>
      </el-table-column>
      <el-table-column
        prop="price"
        label="商品价格">
      </el-table-column>
      <el-table-column>
        <template slot-scope="scope">
          <!-- <el-button @click="addShpCart(scope.row)" type="text" size="small">添加到购物车</el-button>-->
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
  import axios from 'axios'
  axios.defaults.withCredentials=true;
  export default {
    data() {
      return {
        tableData: [],
        input:'null'
      }
    },
    methods:{
      findAll:function (key) {
        key = this.input;
        axios.get("http://localhost:9999/-creditsearch/search/"+key).then(res=>{
          this.tableData=res.data.message;
        })
      }
    },
    mounted(){
      this.findAll(null);
    }
  }
</script>
